<?php
class ui_index_feed extends ui {
	/**
	 * @param object $S
	 * @param array $param = array (
	 * 			page
	 * )
	 */
	public function __construct($S, $param) {
		parent::__construct();
		
		$limit = 30;
		$param['page'] = ($param['page'] > 1) ? intval($param['page']) : 1;
		
		$data_feed = new data_feed();
		
		$feed = $data_feed->ls($this->uid, $param['page'], $limit);
		
		// 判断第一页和最后一页
		$is_last = 0;
		if ($param['page'] > 1 and empty($feed)) {					// 不是第一页，而且没有数据了，那么一定就是最后一页了
			$is_last = 1;
			$param['page'] = $param['page'] - 1;
			$feed = $data_feed->ls($this->uid, $param['page'], $limit);
		}
		
		$S->assign('is_last', 	$is_last);
		$S->assign('page', 	$param['page']);
		$S->assign('feed', 	$feed);
	}
}
?>